package cn.wsalix.weixin.entity;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import lombok.Data;
import lombok.EqualsAndHashCode;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import cn.anlaser.entity.SimpleEntity;
import cn.anlaser.status.DataEnum;
import cn.wsalix.admin.entity.SysUser;

@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "WX_CONFIG")
@Inheritance(strategy = InheritanceType.JOINED)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@EntityListeners({ AuditingEntityListener.class })
@Data
@EqualsAndHashCode(callSuper = false, exclude = {})
public class WxConfig extends SimpleEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = -811703204914088504L;
	private String logo;//头像
	private String popularize;//二维码
	
	private String appId;
	private String appSecret;
	private String serverUrl;//二维码
	private String wxToken;
	private String asekey;

	private String loginEmail;
	private String principal;
	private String address;
	private String servicePhone;
	private DataEnum status;
	private String remark;
	@ManyToOne(cascade = CascadeType.MERGE, optional = true, fetch = FetchType.LAZY)
	@JoinColumn(foreignKey = @ForeignKey(name = "FK_WXCONFIG_USER"), name = "USER_ID")
	private SysUser user;
	private boolean defaultConfig=false;
	
	private String domainName;//认证域名
	private String redirectUri;//回调地址
}
